<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
	<script src="js/jquery-3.3.1.min.js" type="text/javascript" charset="utf-8"></script>
    <style>
        body {
            position: relative;
            text-align: center;
        }

        body>.small {
            display: inline-block;
        }

        body>.big {
            position: absolute;
            top: 0;
            left: 0;
            width: 300px;
            height: 300px;
            display: none;
        }
    </style>
    <script>
        /*
			当鼠标移入页面小图时，在鼠标右侧展示对应大图，
            鼠标移入、移出、移动、事件将对应图片加载到正确位置展示各10分
		*/
        /* 在这里填写jquery代码，禁止修改html代码 */
		window.onload=function(){
			// 获取全部的small
			var imgs=document.querySelectorAll(".small");
			// 获取big
			var big=document.querySelector(".big");
			// 使用for循环
			for (let i = 0; i < imgs.length; i++) {
				// 鼠标移入
				imgs[i].onmousemove=function(e){
					big.style.top=e.y+10+"px";
					big.style.left=e.x+10+"px";
					big.src=this.src;
				}
				// 鼠标移出
				imgs[i].onmouseout=function(){
					big.style.display="none";
				}
				imgs[i].onmouseenter=function(){
					big.style.display="block";
				}
			}	
		}

    </script>
</head>

<body>
    <img class="small" src="./img/toplist_a01.jpg" alt="">
    <img class="small" src="./img/toplist_a02.jpg" alt="">
    <img class="small" src="./img/toplist_a03.jpg" alt="">
    <img class="big" src="./img/toplist_a01.jpg" alt="">
</body>

</html>